﻿using Jay.Sc2.Bof.Lib.State;

namespace Jay.Sc2.Bof.Lib.Action
{
	public class ActionHarvestMinerals : Action
	{
		public static ActionHarvestMinerals Instance = new ActionHarvestMinerals();

		private ActionHarvestMinerals() { }
		public override bool CanExecute(IBuildOrder bo) { return bo.State.WorkersOnGas > 0 && bo.State.MineralPatches > 0; }
		public override bool HaveResources(IBuildOrder bo) { return bo.State.WorkersOnGas > 0 && bo.State.MineralPatches > 0; }
		public override bool HaveTechnology(IBuildOrder bo) { return bo.State.Workers > 0; }
		public override bool IsInvalid(IBuildOrder bo) { return bo.State.WorkersOnGas == 0 || bo.State.MineralPatches == 0; }
		public override void Execute(IBuildOrder bo)
		{
			bo.State.WorkersOnGas--;
			bo.State.WorkersOnMinerals++;
		}
	}
}
